package com.example.testwebsocket.controller;

import com.example.testwebsocket.modle.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/test")
public class TestController {

    @RequestMapping("/login")
    public String testLogin(HttpServletRequest request) {


        User user = new User();
        user.setId(1);
        user.setName("xiaobai");

        HttpSession session = request.getSession(true);
        session.setAttribute("user",user);
//        session.putValue("user", User.class);

//        public String

        return "登录成功";
    }
}
